package com.sky.api.client.admin;

import com.sky.dto.SetmealDTO;
import com.sky.dto.SetmealPageQueryDTO;
import com.sky.entity.Setmeal;
import com.sky.result.PageResult;
import com.sky.result.Result;
import com.sky.vo.SetmealVO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@FeignClient(value = "setmeal-server")
public interface SetmealClient {

    @PostMapping("/admin/setmeal")
    Result save(@RequestBody SetmealDTO setmealDTO);

    /**
     * 分页查询
     *
     * @param setmealPageQueryDTO
     * @return
     */
    @GetMapping("/admin/setmeal/page")
    Result<PageResult> page(SetmealPageQueryDTO setmealPageQueryDTO);

    /**
     * 批量删除套餐
     *
     * @param ids
     * @return
     */
    @DeleteMapping("/admin/setmeal")
    Result delete(@RequestParam List<Long> ids) ;

    /**
     * 根据id查询套餐，用于修改页面回显数据
     *
     * @param id
     * @return
     */
    @GetMapping("/admin/setmeal/{id}")
    Result<SetmealVO> getById(@PathVariable Long id);

    /**
     * 修改套餐
     *
     * @param setmealDTO
     * @return
     */
    @PutMapping("/admin/setmeal")
    Result update(@RequestBody SetmealDTO setmealDTO) ;

    /**
     * 套餐起售停售
     *
     * @param status
     * @param id
     * @return
     */
    @PostMapping("/admin/setmeal/status/{status}")
    Result startOrStop(@PathVariable Integer status, Long id) ;

    //TODO 调用setmealDishMapper.getSetmealIdsByDishIds(ids)
    @GetMapping("/admin/setmeal/getSetmealIdsByDishIds")
    List<Long> getSetmealIdsByDishIds(List<Long> ids);

    //TODO 调用setmealMapper.update(setmeal);
    @PutMapping("/admin/setmeal/update")
    void update(Setmeal setmeal);

    @GetMapping("/admin/setmeal/countByCategoryId")
    Integer countByCategoryId(Long id);
}
